﻿<Window x:Class="ResourceBlender_Express.WinUnusedResources"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:converters="clr-namespace:ResourceBlender_Express.Converters"
    loc:WindowService.EscapeClosesWindow="True"
    Title="Unused Resources" WindowStartupLocation="CenterOwner"
    MinHeight="300" Height="500" MinWidth="400" Width="500"
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlender-Express;component/Resources/images/resourceblender.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Help" Executed="ShowHelp" />
        <CommandBinding Command="NavigationCommands.Refresh" Executed="RefreshResources" CanExecute="CanExecuteRefreshResources" />
        <CommandBinding Command="loc:ResourceBlenderCommands.Delete" Executed="PromptDeleteResources" CanExecute="CanExecuteDeleteResources" />
        <CommandBinding Command="loc:ResourceBlenderCommands.SelectAll" Executed="SelectAllResources" CanExecute="CanExecuteSelectAll" />
    </Window.CommandBindings>
    <Window.Resources>
        <converters:WidthConverter x:Uid="converters:WidthConverter_1" x:Key="WidthConverter" />
        <Image x:Key="Delete_16" Source="pack://application:,,,/Resources/images/resource_delete_16.png" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="58" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="24" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <DockPanel Grid.Row="0" LastChildFill="True" HorizontalAlignment="Stretch" Width="Auto">
            <ToolBar DockPanel.Dock="Right" BorderThickness="0,0,1,1">
                <loc:ImageButton x:Uid="loc:ImageButton_1" Command="ApplicationCommands.Help" Text="Help" Image="Resources/images/question_24.png" ToolTip="Show Help" Style="{StaticResource ToolBarButton}" />
            </ToolBar>
            <ToolBar DockPanel.Dock="Left" BorderThickness="1,0,0,1">
                <loc:ImageButton x:Uid="loc:ImageButton_2" Command="loc:ResourceBlenderCommands.SelectAll" Text="Select All" Image="Resources/images/selectall_24.png" ToolTip="Select All Resources" Style="{StaticResource ToolBarButton}" />
                <loc:ImageButton x:Name="btnDelete" Command="loc:ResourceBlenderCommands.Delete" Text="Delete" Image="Resources/images/resource_delete_24.png" ToolTip="Delete Selected Resources" Style="{StaticResource ToolBarButton}" />
            </ToolBar>
        </DockPanel>

        <Label Grid.Row="1" Margin="6,6,6,0">Language</Label>
        <ListBox Grid.Row="2" x:Name="lstLanguages" Margin="6,0,6,6" SelectionChanged="RefreshResources" ItemTemplate="{StaticResource LanguageListItem}" 
                 SelectedValuePath="Key" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.Style>
                <Style BasedOn="{StaticResource RadioListTemplate}" TargetType="ListBox">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBox">
                                <Border Name="Border" Background="{TemplateBinding Background}" CornerRadius="2"
                                    BorderBrush="{StaticResource SolidBorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                    <ScrollViewer Margin="0" Focusable="false">
                                        <UniformGrid Margin="2" Columns="3" IsItemsHost="True" VerticalAlignment="Top" />
                                    </ScrollViewer>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.Style>
        </ListBox>
            
        <ListView Grid.Row="3" Grid.Column="0" x:Name="lstUnusedResources" Margin="6,0,6,0" ItemsSource="{Binding}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" SelectionMode="Multiple">
            <ListView.View>
                <GridView x:Name="grdUnusedResources">
                    <GridViewColumn Header="Select" CellTemplate="{StaticResource CheckBoxCell}" />
                    <GridViewColumn Header="Translation">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate DataType="translation">
                                <TextBlock Text="{Binding translation}" ToolTip="{Binding translation}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Available Languages">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate DataType="number">
                                <TextBlock Style="{StaticResource FullWidthTextBlock}" Text="{Binding number}" ToolTip="{Binding StringFormat=This resource has been translated into {0} languages,Path=number}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Icon="{StaticResource Delete_16}" Command="loc:ResourceBlenderCommands.Delete" />
                </ContextMenu>
            </ListView.ContextMenu>
        </ListView>
        
        <StatusBar Grid.Row="4">
            <StatusBarItem x:Name="lblStatus" Visibility="Hidden">Loading</StatusBarItem>
            <ProgressBar x:Name="prgStatus" Visibility="Hidden" IsIndeterminate="True" />
        </StatusBar>
    </Grid>
</Window>
